﻿using WPNEXT.ViewModel;
using Microsoft.Phone.Controls;
using System.Windows.Navigation;
using System.Diagnostics;
using System;
using MemoryLook;

namespace WPNEXT
{
    public partial class MainPage : PhoneApplicationPage
    {
        private MainViewModel _main;

        public MainPage()
        {
            InitializeComponent();
            Counter.EnableMemoryCounter = true;
            _main = this.DataContext as MainViewModel;
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _main.OnNavigatedTo(this, e);
            GC.Collect();
            GC.GetTotalMemory(true);
            base.OnNavigatedTo(e);
        }

        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);
            _main.OnNavigatedFrom(this, e);
        }

        private void SimplePhotoListBox_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/SimpleWallPage.xaml", UriKind.Relative));
        }

        private void GuideBtnClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/GuidePage.xaml", UriKind.Relative));
        }

        private void ListBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/ListBoxDemo.xaml", UriKind.Relative));
        }

        private void ExplodePhotoListBox_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/ExplodeWallPage.xaml", UriKind.Relative));
        }

        private void PageSpliterPage_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/Views/PageSpliterPage.xaml", UriKind.Relative));
        }
    }
}
